package sdk.weinxin.beans.massmessage;

import sdk.weinxin.beans.massmessage.preview.Preview;

import sdk.weinxin.beans.massmessage.preview.VoicePreview;
import sdk.weinxin.beans.message.Media;

public class MassVoiceMessage extends MassMessage {

    private Media voice;
    public MassVoiceMessage() {
        super();
        this.setMsgType("voice");
    }
    public MassVoiceMessage(String mediaId) {
        super();
        voice = new Media(mediaId);
        this.setMsgType("voice");
    }

    public Media getVoice() {
        return voice;
    }

    public void setVoice(Media voice) {
        this.voice = voice;
    }

    @Override
    public Preview convert() {
        Preview preview = new VoicePreview(voice.getMediaId());
        if (this.getToUser() != null && this.getToUser().size() > 0) {
            preview.setToUser(this.getToUser().iterator().next());
        }
        return preview;
    }

}
